Automatic optical inspection method of periodic patterns

ABSTRACT

An automatic optical inspection method for periodic patterns includes defining regular control points in a periodic pattern, forming aligned images surrounded by the control points, obtaining a median image and a deviation image from the aligned images and defining upper- and lower-limit images to form an adaptive model, using the adaptive model to compare each point of all aligned images, defining the point of the aligned image having a gray-scale pixel greater than the upper-limit image or the smaller than the lower-limit image as a defect area. The optical inspection method is applicable for the defect detection of various periodic patterns and users simply need to manually select a first reference point to a fifth reference point from the control points and further select a rectangular range of one of the control points to create an edge image to detect a defect of the periodic pattern.

FIELD OF THE INVENTION

The present invention relates to an automatic optical inspection method for periodic patterns, in particular to the automatic optical inspection method capable of detecting a defective portion of a periodic pattern accurately and quickly.

BACKGROUND OF THE INVENTION

Surface inspection based on machine vision has been widely used for controlling the surface quantity of various products. For example, the quality of wood, steel, wafer, ceramic, textile and even the surface of an agricultural product may be inspected by optical surface inspection.

At present, touch panels tend to be designed with optimized, personalized and intuitive operations and controls to provide a convenient use, so that the touch panels can be applied extensively in various electric and electronic products such as personal computer, Smartphone, cashier machine, automatic transfer machine (ATM), and electric appliance. The quality of the touch panel directly affects the overall appearance quality and quality of an electric appliance or product as well as the yield and profit of related manufacturers. Therefore, the manufacturers demand a very high quality of the touch panels. Since a sensing circuit is installed in the touch panel, therefore if the touch panel has particles, scratches, fibers or dirt on its surface, then the effect of the sensing circuit will be affected adversely. Now, the defect detection has become one of the important and mostly needed processes in the production of the touch panels.

With reference to FIG. 1 for a spectral analysis applied extensively in conventional automatic optical inspections (AOI), an energy spectrum 20 as shown in FIG. 1(b) is obtained after performing the Fast Fourier Transform (FFT) of a touch panel 10 as depicted in FIG. 1(a) and provided for observing a major portion of energy concentrated at four directional lines including a horizontal line, a vertical line and two diagonals, wherein the angle of the diagonal varies with various different structures of circuits, and the angle of the diagonal may be estimated by the largest protruding portion of the energy spectrum 20 as shown in FIG. 1(c), and the angle of the diagonal is approximately equal to 31 degrees, and narrow stop-bands of the aforementioned four directional lines are used for the notch filtering of the energy spectrum 20 as shown in FIG. 1(b), and a reconstructed image 30 as shown in FIG. 1(d) is obtained after performing the Inverse Fast Fourier Transform (FFT). However, most circuits are eliminated while the non-circuits are also eliminated as well, and thus causing difficult distinction and complicated design of the products using notch filtering. Obviously, the spectral analysis is not an effective method for inspecting the touch panel 10.

Therefore, another automatic optical inspection method using Computer Aided Design (CAD) for drawing figures and making marks on the figures of a desired testing touch panel is available, and CAD drawings require the calibration of a camera to eliminate the distortion of the figures before the expected drawing effect can be achieved. However, the calibration of the camera incurs additional development work and cost. For high inspection efficiency, the equipment cost will be very high.

In view of the aforementioned problems, the inventor of the present invention based on years of experience in the related industry to conduct extensive researches and experiments, and finally designed an automatic optical inspection method to solve the problems of the prior art.

SUMMARY OF THE INVENTION

Therefore, it is a primary objective of the present invention to provide an automatic optical inspection method to overcome the drawbacks of the conventional method including the insufficient inspection accuracy, the additional development work and cost, and the substantial increase of equipment costs incurred by improving the inspection efficiency.

To achieve the aforementioned objective, the present invention provides an automatic optical inspection method for periodic patterns comprising the steps of: defining a plurality of regular control points in a periodic pattern; surrounding the control points to form a plurality of aligned images with the same size and direction; obtaining a median image and a deviation image from consecutive aligned images; defining an upper-limit image and a lower-limit image by the median image and the deviation image to create an adaptive model; comparing each point of the aligned image by using the adaptive model; and defining a point in the aligned image with a gray-scale pixel greater than that of the upper-limit image or smaller than the lower-limit image as a defect area.

The aforementioned automatic optical inspection method for periodic patterns further comprises the steps of: selecting a first reference point to a fifth reference point in the periodic pattern, wherein the first reference point is a control point situated at the upper leftmost position of the periodic pattern, the second reference point is a control point situated at the upper rightmost position of the periodic pattern, the third reference point a control point situated at the lower leftmost position of the periodic pattern, the fourth reference point is a control point adjacent to the first reference point in the horizontal direction, and the fifth reference point is a control point adjacent to the first reference point the vertical direction; and using the gap between the first reference point and the fourth reference point as a horizontal gap, the gap between the first reference point and the fifth reference point as a vertical gap, and the second reference point and the third reference point as extrema respectively to define the positions of all points in the periodic pattern.

The aforementioned automatic optical inspection method for periodic patterns further comprises the steps of creating a rectangular range for one of the control points, and the rectangular range being free of defects, and an edge image of the periodic pattern being detected in the rectangular range; and correcting the positions of all control points according to the edge image.

In the aforementioned automatic optical inspection method for periodic patterns, the rectangular range is detected by an edge detector to obtain a binary edge image.

The aforementioned automatic optical inspection method for periodic patterns further comprises the steps of: defining a center point of the edge image in advance; creating a rectangular search range with the control point as the center for each control point, such that the edge image and the center point are moved within the search range until the edge image is coupled to the periodic pattern; and correcting the positions of all control points by bit comparison.

The aforementioned automatic optical inspection method for periodic patterns further comprises the step of: defining four target points, and the target points surrounding and forming a rectangular target area, and the control points surrounding and forming a quadrilateral area; and transforming the control point of each quadrilateral area into a target point of the target area by a set of transformation matrices to obtain at least one set of transformation parameters, and the control point being transformed according to the transformation parameter to obtain the aligned image formed and surrounded by the control points.

In the aforementioned automatic optical inspection method for periodic patterns, the median image and the deviation image are obtained from at least three of the consecutive aligned images. Preferably, the median image and the deviation image are obtained from at least five of the consecutive aligned images.

The aforementioned automatic optical inspection method for periodic patterns further comprises the step of transforming each point in the defect area into the original coordinate system, if the point in the aligned image is defined as the defect area.

In the aforementioned automatic optical inspection method for periodic patterns, the periodic pattern is a periodic pattern of a touch panel, a printed circuit board or an object surface.

In summation of the description above, the present invention has the following advantages and effects:

1. The present invention may be applied to various products with a periodic pattern, such as a touch panel, a printed circuit board or a surface of various objects, and the invention no longer requires calibration before the inspection anymore, but simply requires user to manually select a first reference point to a fifth reference point and select a rectangular range of one of the control points to create an edge image, such that the defect of the periodic pattern will be detected automatically and accurately periodic pattern to reduce the labor, time, and cost significantly.

2. The method of the present invention defines an adaptive model of an upper-limit image and a lower-limit image by a median image and a deviation image, so that there are only two control parameters, respectively: detection rate and wrong detection rate, so that adjustments can be made according to customer requirements easily to control the detection quantity of the defects of the periodic pattern effectively.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a flow chart of an experiment on a conventional automatic optical inspection for detecting the defects of a touch panel;

FIG. 2 is a flow chart of the present invention;

FIG. 3 is a schematic view of a periodic pattern of the present invention;

FIG. 4 is a schematic view of selecting the first to the fifth reference points from a periodic pattern in accordance with the present invention;

FIG. 5 is a schematic view of drawing one of the control points manually to create a rectangular range in accordance with the present invention;

FIG. 6 is a schematic view of an edge image of the present invention;

FIG. 7 is a schematic view of correcting the position of a control point by an edge image in accordance with the present invention;

FIG. 8 is a schematic view of transforming a control point of each quadrilateral area into a target point of the target area by a set of transformation matrices to obtain an aligned image in accordance with the present invention;

FIG. 9 is a schematic view of consecutive aligned images formed after the transformation in accordance with the present invention;

FIG. 10 is a schematic view of a median image of the present invention.

FIG. 11 is a schematic view of a deviation image of the present invention;

FIG. 12 is a schematic view of an experiment on applying the present invention to a touch panel;

FIG. 13 is a schematic view of another experiment on applying the present invention to a touch panel;

FIG. 14 is a characteristic curve of a receiver's operation drawn according to the constant control parameter β and the variable control parameter α by using the touch panel as depicted in FIG. 12;

FIG. 15 is a characteristic curve of a receiver's operation drawn according to the constant control parameter β and the variable control parameter α by using the touch panel as depicted in FIG. 12;

FIG. 16 is a characteristic curve of a receiver's operation drawn according to the constant control parameter β and the variable control parameter α by using the touch panel as depicted in FIG. 13; and

FIG. 17 is a characteristic curve of a receiver's operation drawn according to the constant control parameter β and the variable control parameter α by using the touch panel as depicted in FIG. 12.

DESCRIPTION OF THE PREFERRED EMBODIMENTS

The present invention will become clearer in light of the following detailed description of an illustrative embodiment of this invention described in connection with the drawings. It is intended that the embodiments and drawings disclosed herein are to be considered illustrative rather than restrictive.

With reference to FIG. 2 for an automatic optical inspection method for periodic patterns of the present invention, the method comprises the following steps:

Offline Phase:

Step (S001): Select a periodic pattern 1 for the detect inspection as shown in FIG. 3, wherein the periodic pattern 1 may be a periodic pattern of a touch panel, a printed circuit board or a surface of an object, and the periodic pattern of this embodiment is a periodic pattern of the touch panel, but the invention is not limited to the touch panel only. A pattern is determined to be a periodic pattern 1 if the pattern is repetitive as determined manually or by a compute. Therefore, the regularity of a periodic pattern 1 may be found manually or by a computer easily, and users may select a control point 2 capable of determining a periodic reference from a periodic pattern 1.

In a preferred embodiment as shown in FIG. 4, a user may select a first reference point to a fifth reference point as a control point of the periodic pattern 1, wherein the first reference point A is a control point 2 situated at the upper leftmost position of the periodic pattern 1, the second reference point B is a control point 2 situated at the upper rightmost position of the periodic pattern 1, the third reference point C is a control point 2 situated at the lower leftmost position of the periodic pattern 1, the fourth reference point B′ is a control point 2 adjacent to the first reference point in a horizontal direction, and the fifth reference point C′ is a control point 2 adjacent to the first reference point in a vertical direction. If the gap between the first reference point A and the fourth reference point B′ is defined as a horizontal gap AB′, the gap between the first reference point A and the fifth reference point C′ is defined as a vertical gap AC′, and the second reference point B and the third reference point C are defined as extrema, then the number of rows N_(Row) and the number of columns N_(Col) of all control points 2 are expressed in the Mathematical Equation 1 below:

$\begin{matrix} \begin{matrix} {{N_{Row} = {{{round}\left( \frac{\overset{\_}{A\; C}}{\overset{\_}{A\; C^{\prime}}} \right)} + 1}},} \\ {N_{Col} = {{{round}\left( \frac{\overset{\_}{AB}}{\overset{\_}{{AB}^{\prime}}} \right)} + 1}} \end{matrix} & \left\lbrack {{Mathematical}\mspace{14mu}{Equation}\mspace{14mu} 1} \right\rbrack \end{matrix}$

Therefore, the period in row u_(Row) and the period in column u_(Col) are calculated by the Mathematical Equation 2 below:

$\begin{matrix} {{u_{Row} = \frac{\overset{\_}{A\; C}}{\left( {N_{Row} - 1} \right)}},{u_{Col} = \frac{\overset{\_}{AB}}{\left( {N_{Col} - 1} \right)}}} & \left\lbrack {{Mathematical}\mspace{14mu}{Equation}\mspace{14mu} 2} \right\rbrack \end{matrix}$

The coordinates of all control point 2 CP_(i,j) are calculated by the Mathematical Equation 3 below: CP_(i,j)=(x _(A) ;y _(A))+i·u _(Row) +j·u _(Col), for i=0,1, . . . ,N _(Row)−1,j=0,1, . . . ,N _(Col)−1  [Mathematical Equation 3] Where, (x_(A), y_(A)) are the coordinates of the first reference point A used for defining the positions of all the control points 2 in the periodic pattern 1.

Step (S002): Since the position of the control point 2 may be deviated by selecting the first reference point A to the fifth reference point C′ manually, therefore the position at the periodic reference of the control point 2 is incorrect. In FIG. 5, a user as shown in FIG. 5 draws one of the control points 2 manually to create a rectangular range 21 (which is the region of interest, ROI), and the rectangular range 21 is free of defects or noises and used for identifying an edge. Further, a Canny edge detector is used for detecting an edge of the periodic pattern 1 in the rectangular range 21 to obtain a binary edge image 3 as shown in FIG. 6.

Online Testing Phase:

Step (S003): In FIG. 6, a center point 31 is defined in the edge image 3 in advance. In FIG. 7, a rectangular search range 22 is created for each control point 2 by using the control point 2 as the center, and the edge image 3 and the center point 31 are moved in the search range 22 until the edge image 3 is coupled to the periodic pattern 1. In the following Mathematical Equation 4, the positions of all control points 2 are corrected by bit comparison: S(O,C)=ΣO(i,j)⊕C(i,j)  [Mathematical Equation 4]

Where, S(O, C) is the match scale of the periodic pattern 1 and the edge image 3, O(i, j) is the periodic pattern 1, ⊕ is the bit comparison, and C(i, j) is the position of the coordinates of the control point 2 with the maximum match scale after the edge image 3 is corrected.

Step (S004): The control points 2 surround and form a quadrilateral area 23 and define four target points 4, and the target points 4 also surround and form a rectangular target area 41. In this embodiment, the target area 41 has a height H and a width W, and the target point 4 are (x′₁, y′₁)=(0,0), (x′₂, y′₂)=(W−1,0), (x′₃, y′₃)=(0, H−1) and (x′₄, y′₄)=(W−1, H−1). In FIG. 8, the control points 2 of each quadrilateral area 23 are transformed into the target points 4 of the target area 41 respectively by a set of transformation matrices, and the transformation matrices are given in the Mathematical Equation 5 below:

$\begin{matrix} {\begin{bmatrix} x_{1} & y_{1} & 1 & 0 & 0 & 0 & {{- x_{1}}x_{1}^{\prime}} & {{- y_{1}}x_{1}^{\prime}} \\ 0 & 0 & 0 & x_{1} & y_{1} & 1 & {{- x_{1}}y_{1}^{\prime}} & {{- y_{1}}y_{1}^{\prime}} \\ x_{2} & y_{2} & 1 & 0 & 0 & 0 & {{- x_{2}}x_{2}^{\prime}} & {{- y_{2}}x_{2}^{\prime}} \\ 0 & 0 & 0 & x_{2} & y_{2} & 1 & {{- x_{2}}y_{2}^{\prime}} & {{- y_{2}}y_{2}^{\prime}} \\ x_{3} & y_{3} & 1 & 0 & 0 & 0 & {{- x_{3}}x_{3}^{\prime}} & {{- y_{3}}x_{3}^{\prime}} \\ 0 & 0 & 0 & x_{3} & y_{3} & 1 & {{- x_{3}}y_{3}^{\prime}} & {{- y_{3}}y_{3}^{\prime}} \\ x_{4} & y_{4} & 1 & 0 & 0 & 0 & {{- x_{4}}x_{4}^{\prime}} & {{- y_{4}}x_{4}^{\prime}} \\ 0 & 0 & 0 & x_{4} & y_{4} & 1 & {{- x_{4}}y_{4}^{\prime}} & {{- y_{4}}y_{4}^{\prime}} \end{bmatrix}{\quad{\begin{bmatrix} h_{11} \\ h_{12} \\ h_{13} \\ h_{21} \\ h_{22} \\ h_{23} \\ h_{31} \\ h_{32} \end{bmatrix} = \begin{bmatrix} x_{1}^{\prime} \\ y_{1}^{\prime} \\ x_{2}^{\prime} \\ y_{2}^{\prime} \\ \begin{matrix} x_{3}^{\prime} \\ y_{3}^{\prime} \\ x_{4}^{\prime} \\ y_{4}^{\prime} \end{matrix} \end{bmatrix}}}} & \left\lbrack {{Mathematical}\mspace{14mu}{Equation}\mspace{14mu} 5} \right\rbrack \end{matrix}$

Where, (x_(i), y_(i)) represents the coordinates of the original control point 2, and (x′_(i), y′_(i)) represents the coordinates of the target point 4, and these coordinates are used for obtaining at least one set of transformation parameters hij, and performing a transformation by the following Mathematical Equation 6 to obtain an aligned image 5 surrounded and formed by the control point 2 and having the same size and direction.

$\begin{matrix} {\begin{bmatrix} x^{\prime} \\ y^{\prime} \\ 1 \end{bmatrix} = {\frac{\begin{bmatrix} h_{11} & h_{12} & h_{13} \\ h_{21} & h_{22} & h_{23} \\ h_{31} & h_{32} & 1 \end{bmatrix}\begin{bmatrix} x \\ y \\ 1 \end{bmatrix}}{\begin{bmatrix} h_{31} & h_{22} & 1 \end{bmatrix}\begin{bmatrix} x \\ y \\ 1 \end{bmatrix}} = {G\begin{bmatrix} x \\ y \\ 1 \end{bmatrix}}}} & \left\lbrack {{Mathematical}\mspace{14mu}{Equation}\mspace{14mu} 6} \right\rbrack \end{matrix}$

Step (S005): In FIG. 9, consecutive aligned images 5 and the following Mathematical Equation 7 are used to obtain a median image 51 m(x′, y′) as shown in FIG. 10 and a deviation image 52 d(x′, y′) as shown in FIG. 11:

$\begin{matrix} \left\{ \begin{matrix} \begin{matrix} {{m\left( {x^{\prime},y^{\prime}} \right)} = {{median}\left\{ {{g_{p}\left( {x^{\prime},y^{\prime}} \right)},} \right.}} \\ {{{{for}\mspace{14mu} p} = {k - M}},\ldots\mspace{14mu},{k + M}} \end{matrix} \\ \begin{matrix} {{d\left( {x^{\prime},y^{\prime}} \right)} =} \\ \sqrt{\frac{1}{N}{\sum\limits_{p = {k - M}}^{k + M}\left( {{g_{p}\left( {x^{\prime},y^{\prime}} \right)} - {m\left( {x^{\prime},y^{\prime}} \right)}} \right)^{2}}} \end{matrix} \end{matrix} \right. & \left\lbrack {{Mathematical}\mspace{14mu}{Equation}\mspace{14mu} 7} \right\rbrack \end{matrix}$

where, g_(p)(x′, y′) is the aligned image 5, k is the median of the quantity of aligned images 5, N is the quantity of the odd aligned images 5, and M=[N/2]; and the median image 51 and the deviation image 52 are obtained by at least three of the consecutive aligned images 5, preferably by at least five of the consecutive aligned images 5 to improve the effect of obtaining the median image 51 and the deviation image 52.

Step (S006): An upper-limit image u(x′, y′) and a lower-limit image l(x′, y′) are defined by the median image 51 and the deviation image 52 and the following Mathematical Equation 8 to form an adaptive model.

$\begin{matrix} \left\{ \begin{matrix} {{u\left( {x^{\prime},y^{\prime}} \right)} = {{m\left( {x^{\prime},y^{\prime}} \right)} + {\max\left( {\alpha,{\beta \cdot {d\left( {x^{\prime},y^{\prime}} \right)}}} \right)}}} \\ {{l\left( {x^{\prime},y^{\prime}} \right)} = {{m\left( {x^{\prime},y^{\prime}} \right)} - {\max\left( {\alpha,{\beta \cdot {d\left( {x^{\prime},y^{\prime}} \right)}}} \right)}}} \end{matrix} \right. & \left\lbrack {{Mathematical}\mspace{14mu}{Equation}\mspace{14mu} 8} \right\rbrack \end{matrix}$

where, α and β are control parameters for controlling sensitivity and specificity to further control the detection rate and the wrong detection rate.

Step (S007): The adaptive model is provided for comparing each point (x′, y′) of the aligned image 5, and defining the point (x′, y′) of the aligned image 5 having a gray-scale pixel greater than that of the upper-limit image or the smaller than the lower-limit image as a defect area. In an embodiment, the defect determination formula b(x′, y′) in the following Mathematical Equation 9 is used for determining whether or not the point (x′, y′) is a defect area:

$\begin{matrix} {{b\left( {x^{\prime},y^{\prime}} \right)} = \left\{ \begin{matrix} {1,{{{if}\mspace{14mu}{g_{p}\left( {x^{\prime},y^{\prime}} \right)}} > {{u\left( {x^{\prime},y^{\prime}} \right)}\mspace{14mu}{or}}}} \\ {{g_{p}\left( {x^{\prime},y^{\prime}} \right)} < {1\left( {x^{\prime},y^{\prime}} \right)}} \\ {0,\mspace{14mu}{otherwise}} \end{matrix}\mspace{14mu} \right.} & \left\lbrack {{Mathematical}\mspace{14mu}{Equation}\mspace{14mu} 9} \right\rbrack \end{matrix}$

Wherein, if one of the points (x′, y′) is 1 computed by the defect determination formula, then such point (x′, y′) is defined as a defect area. If one of the points (x′, y′) is 1 computed by the defect determination formula, then such point (x′, y′) is defined as free of detects.

Step (S008): If the point (x′, y′) in the aligned image 5 is defined as the defect area according to Step S007, then the following Mathematical Equation 10 may be used for transforming each point (x′, y′) in the aligned image 5 defined as a defect area back to the original coordinate system by the inverse matrix G−1 of the transformation matrix G of the aforementioned Mathematical Equation 6, so as to mark a portion with defect in the periodic pattern 1.

$\begin{matrix} {\begin{bmatrix} x \\ y \\ 1 \end{bmatrix} = {G^{- 1}\begin{bmatrix} x^{\prime} \\ y^{\prime} \\ 1 \end{bmatrix}}} & \left\lbrack {{Mathematical}\mspace{14mu}{Equation}\mspace{14mu} 10} \right\rbrack \end{matrix}$

The optical inspection method of the present invention is run by C⁺⁺ program run operated at a 2.5 GHz CPU with the Intel Core i5 specification. The optical inspection method used for inspecting a circuit of a 4.3-inch touch panel 6 with a periodic pattern 1 a as shown in FIG. 12 just takes 3.52 seconds to mark the defects in the periodic pattern 1 a as shown in FIG. 12, and 3.38 seconds to mark the defects of a periodic pattern 1 b of a 4.7-inch touch panel 6 b as shown in FIG. 13.

In addition, the present invention may adjust the control parameters α, β to observe the detection rate and the wrong detection rate of the defects detected at different control parameters α, β through a receiver operating characteristic (ROC) curve of false positive rate (FPR) versus true positive rate (TPR).

If better control parameters α, β are used for detecting defects, and the present invention is applied to the touch panel 6 a as shown in FIG. 12, and control parameter β is fixed to 4, 4.5 and 5 as shown in FIG. 12, the control parameter α will change from 7 to 13. Obviously, a smaller control parameter α has a higher TPR an d a lower FPR, so that it is necessary to select a moderate operation point when the control parameter α is 10 in order to capture a TPR greater than 90% and a FPR smaller than 10%. The receiver operating characteristic curve as shown in FIG. 15 and drawn while fixing the control parameter α to 10, and changing the control parameter β to a range from 3.5 to 7 indicates that the moderate operation point falls at a position where the control parameter β is equal to 4.5. In the touch panel 6 a as shown in FIG. 12, the values of the control parameters α, β are 10 and 4.5 respectively. FIG. 16 shows a receiver operating characteristic curve of a touch panel 6 b shown in FIG. 13 and drawn when the constant control parameter β is fixed to 5 and 5.5, and the control parameter α is changed to a range from 7 to 13. FIG. 17 shows a receiver operating characteristic curve drawn by setting a moderate operation point shown in FIG. 16 when the control parameter α is set to 10, and the control parameter α is set to 10 and the control parameter β is changed to a range from 3.5 to 7.

In the touch panel 6 b as shown in FIG. 13, better control parameters α, β are 10 and 5, or 10 and 5.5 respectively.

In summation of the description above, the technical measures disclosed in the present invention overcome the drawbacks of the prior art and achieve the expected objectives and effects. In addition, the present invention has not been published or disclosed publicly prior to filing the patent application, and the invention complies with the patent application requirements, and is submitted to the Patent and Trademark Office for review and granting of the commensurate patent rights.

While the invention has been described by means of specific embodiments, numerous modifications and variations could be made thereto by those skilled in the art without departing from the scope and spirit of the invention set forth in the claims. 

What is claimed is:
 1. An automatic optical inspection method for periodic patterns, comprising the steps of: defining a plurality of regular control points in a periodic pattern; surrounding the control points to form a plurality of aligned images with the same size and direction; obtaining a median image and a deviation image from consecutive aligned images; defining an upper-limit image and a lower-limit image by the median image and the deviation image to create an adaptive model; comparing each point of the aligned image by using the adaptive model; and defining a point in the aligned image with a gray-scale pixel greater than that of the upper-limit image or smaller than the lower-limit image as a defect area.
 2. The automatic optical inspection method for periodic patterns as claimed in claim 1, further comprising the steps of: selecting a first reference point to a fifth reference point in the periodic pattern, wherein the first reference point is a control point situated at the upper leftmost position of the periodic pattern, the second reference point is a control point situated at the upper rightmost position of the periodic pattern, the third reference point a control point situated at the lower leftmost position of the periodic pattern, the fourth reference point is a control point adjacent to the first reference point in the horizontal direction, and the fifth reference point is a control point adjacent to the first reference point the vertical direction; and using the gap between the first reference point and the fourth reference point as a horizontal gap, the gap between the first reference point and the fifth reference point as a vertical gap, and the second reference point and the third reference point as extrema respectively to define the positions of all points in the periodic pattern.
 3. The automatic optical inspection method for periodic patterns as claimed in claim 1, further comprising the steps of: creating a rectangular range for one of the control points, and the rectangular range being free of defects, and an edge image of the periodic pattern being detected in the rectangular range; and correcting the positions of all control points according to the edge image.
 4. The automatic optical inspection method for periodic patterns as claimed in claim 3, wherein the rectangular range is detected by an edge detector to obtain a binary edge image.
 5. The automatic optical inspection method for periodic patterns as claimed in claim 3, further comprising the steps of: defining a center point of the edge image in advance; creating a rectangular search range with the control point as the center for each control point, such that the edge image and the center point are moved within the search range until the edge image is coupled to the periodic pattern; and correcting the positions of all control points by bit comparison.
 6. The automatic optical inspection method for periodic patterns as claimed in claim 1, further comprising the steps of: defining four target points, and the target points surrounding and forming a rectangular target area, and the control points surrounding and forming a quadrilateral area; and transforming the control point of each quadrilateral area into a target point of the target area by a set of transformation matrices to obtain at least one set of transformation parameters, and the control point being transformed according to the transformation parameter to obtain the aligned image formed and surrounded by the control points.
 7. The automatic optical inspection method for periodic patterns as claimed in claim 6, wherein the transformation parameter hij is calculated by the following Equation 1: $\begin{matrix} {{\begin{bmatrix} x_{1} & y_{1} & 1 & 0 & 0 & 0 & {{- x_{1}}x_{1}^{\prime}} & {{- y_{1}}x_{1}^{\prime}} \\ 0 & 0 & 0 & x_{1} & y_{1} & 1 & {{- x_{1}}y_{1}^{\prime}} & {{- y_{1}}y_{1}^{\prime}} \\ x_{2} & y_{2} & 1 & 0 & 0 & 0 & {{- x_{2}}x_{2}^{\prime}} & {{- y_{2}}x_{2}^{\prime}} \\ 0 & 0 & 0 & x_{2} & y_{2} & 1 & {{- x_{2}}y_{2}^{\prime}} & {{- y_{2}}y_{2}^{\prime}} \\ x_{3} & y_{3} & 1 & 0 & 0 & 0 & {{- x_{3}}x_{3}^{\prime}} & {{- y_{3}}x_{3}^{\prime}} \\ 0 & 0 & 0 & x_{3} & y_{3} & 1 & {{- x_{3}}y_{3}^{\prime}} & {{- y_{3}}y_{3}^{\prime}} \\ x_{4} & y_{4} & 1 & 0 & 0 & 0 & {{- x_{4}}x_{4}^{\prime}} & {{- y_{4}}x_{4}^{\prime}} \\ 0 & 0 & 0 & x_{4} & y_{4} & 1 & {{- x_{4}}y_{4}^{\prime}} & {{- y_{4}}y_{4}^{\prime}} \end{bmatrix}\begin{bmatrix} h_{11} \\ h_{12} \\ h_{13} \\ h_{21} \\ h_{22} \\ h_{23} \\ h_{31} \\ h_{32} \end{bmatrix}} = \begin{bmatrix} x_{1}^{\prime} \\ y_{1}^{\prime} \\ x_{2}^{\prime} \\ y_{2}^{\prime} \\ \begin{matrix} x_{3}^{\prime} \\ y_{3}^{\prime} \\ x_{4}^{\prime} \\ y_{4}^{\prime} \end{matrix} \end{bmatrix}} & \left( {{Equation}\mspace{14mu} 1} \right) \end{matrix}$ where, (x_(i), y_(i)) represents the coordinates of a control point, and (x′_(i), y′_(i)) represents the coordinates of a target point.
 8. The automatic optical inspection method for periodic patterns as claimed in claim 7, wherein the aligned image is calculated according to the following Equation 2: $\begin{matrix} {\begin{bmatrix} x^{\prime} \\ y^{\prime} \\ 1 \end{bmatrix} = {\frac{\begin{bmatrix} h_{11} & h_{12} & h_{13} \\ h_{21} & h_{22} & h_{23} \\ h_{31} & h_{32} & 1 \end{bmatrix}\begin{bmatrix} x \\ y \\ 1 \end{bmatrix}}{\begin{bmatrix} h_{31} & h_{22} & 1 \end{bmatrix}\begin{bmatrix} x \\ y \\ 1 \end{bmatrix}} = {{G\begin{bmatrix} x \\ y \\ 1 \end{bmatrix}}.}}} & \left( {{Equation}\mspace{14mu} 2} \right) \end{matrix}$
 9. The automatic optical inspection method for periodic patterns as claimed in claim 8, further comprising the steps of: transforming each point in the defect area into the original coordinate system by the inverse matrix transformation of the matrix G of Equation 2, if the point in the aligned image is defined as the defect area.
 10. The automatic optical inspection method for periodic patterns as claimed in claim 1, wherein the median image m(x′, y′) and deviation image d(x′, y′) are calculated by the following Equation 3: $\begin{matrix} \left\{ {\begin{matrix} {{m\left( {x^{\prime},y^{\prime}} \right)} = {{median}\left\{ {{g_{p}\left( {x^{\prime},y^{\prime}} \right)},{{{for}\mspace{14mu} p} = {k - M}},\ldots\mspace{14mu},{k + M}} \right.}} \\ {{d\left( {x^{\prime},y^{\prime}} \right)} = \sqrt{\frac{1}{N}{\sum\limits_{p = {k - M}}^{k + M}\left( {{g_{p}\left( {x^{\prime},y^{\prime}} \right)} - {m\left( {x^{\prime},y^{\prime}} \right)}} \right)^{2}}}} \end{matrix},} \right. & \left( {{Equation}\mspace{14mu} 3} \right) \end{matrix}$ where, g_(p)(x′, y′) is the aligned image, k is the median of the quantity of aligned images, N is the quantity of the odd aligned images, and M=[N/2].
 11. The automatic optical inspection method for periodic patterns as claimed in claim 10, wherein the median image and the deviation image are obtained from at least three of the consecutive aligned images.
 12. The automatic optical inspection method for periodic patterns as claimed in claim 10, wherein the median image and the deviation image are obtained from at least five of the consecutive aligned images.
 13. The automatic optical inspection method for periodic patterns as claimed in claim 10, wherein the upper-limit image u(x′, y′) and the lower-limit image l(x′, y′) are calculated by the following Equation 4: $\begin{matrix} \left\{ \begin{matrix} {{u\left( {x^{\prime},y^{\prime}} \right)} = {{m\left( {x^{\prime},y^{\prime}} \right)} + {\max\left( {\alpha,{\beta \cdot {d\left( {x^{\prime},y^{\prime}} \right)}}} \right)}}} \\ {{l\left( {x^{\prime},y^{\prime}} \right)} = {{m\left( {x^{\prime},y^{\prime}} \right)} - {\max\left( {\alpha,{\beta \cdot {d\left( {x^{\prime},y^{\prime}} \right)}}} \right)}}} \end{matrix} \right. & \left( {{Equation}\mspace{14mu} 4} \right) \end{matrix}$ where, α and β are control parameters.
 14. The automatic optical inspection method for periodic patterns as claimed in claim 1, wherein the periodic pattern is a periodic pattern of a touch panel, a printed circuit board or an object surface. 